package com.lingshu.app.model.structure;

import androidx.databinding.Bindable;

import com.lingshu.app.BR;

/**
 * 甲状腺结构化数据
 */
public class ThyroidStructureData extends StructureData {
    private Integer exceptionalThyroidR = 0;
    private Integer exceptionalThyroidL = 0;
    private Integer suffuseThyroidR;
    private Integer suffuseThyroidL;
    private Double widthThyroidR = 0D;
    private Double widthThyroidL = 0D;
    private Double heightThyroidR = 0D;
    private Double heightThyroidL = 0D;
    private Integer typeThyroidR;
    private Integer typeThyroidL;
    private Integer echoesThyroidR;
    private Integer echoesThyroidL;
    private Integer cysticSolidThyroidR;
    private Integer cysticSolidThyroidL;
    private Integer boundaryThyroidR;
    private Integer boundaryThyroidL;
    private Integer aspectThyroidR;
    private Integer aspectThyroidL;
    private Integer calcificationThyroidR;
    private Integer calcificationThyroidL;
    private Integer levelThyroidR;
    private Integer levelThyroidL;
    private Boolean enableThyroidR = false;
    private Boolean enableThyroidL = false;

    @Bindable
    public Integer getExceptionalThyroidR() {
        return exceptionalThyroidR;
    }

    public void setExceptionalThyroidR(Integer exceptionalThyroidR) {
        this.exceptionalThyroidR = exceptionalThyroidR;
        updateOtherProperty(true);
        notifyPropertyChanged(BR.enableThyroidR);
        notifyPropertyChanged(BR.suffuseThyroidR);
        notifyPropertyChanged(BR.widthThyroidR);
        notifyPropertyChanged(BR.heightThyroidR);
        notifyPropertyChanged(BR.typeThyroidR);
        notifyPropertyChanged(BR.echoesThyroidR);
        notifyPropertyChanged(BR.cysticSolidThyroidR);
        notifyPropertyChanged(BR.boundaryThyroidR);
        notifyPropertyChanged(BR.aspectThyroidR);
        notifyPropertyChanged(BR.calcificationThyroidR);
        notifyPropertyChanged(BR.levelThyroidR);
    }

    @Bindable
    public Integer getExceptionalThyroidL() {
        return exceptionalThyroidL;
    }

    public void setExceptionalThyroidL(Integer exceptionalThyroidL) {
        this.exceptionalThyroidL = exceptionalThyroidL;
        updateOtherProperty(false);
        notifyPropertyChanged(BR.enableThyroidL);
        notifyPropertyChanged(BR.enableThyroidL);
        notifyPropertyChanged(BR.suffuseThyroidL);
        notifyPropertyChanged(BR.widthThyroidL);
        notifyPropertyChanged(BR.heightThyroidL);
        notifyPropertyChanged(BR.typeThyroidL);
        notifyPropertyChanged(BR.echoesThyroidL);
        notifyPropertyChanged(BR.cysticSolidThyroidL);
        notifyPropertyChanged(BR.boundaryThyroidL);
        notifyPropertyChanged(BR.aspectThyroidL);
        notifyPropertyChanged(BR.calcificationThyroidL);
        notifyPropertyChanged(BR.levelThyroidL);
    }

    @Bindable
    public Integer getSuffuseThyroidR() {
        return suffuseThyroidR;
    }

    @Bindable
    public void setSuffuseThyroidR(Integer suffuseThyroidR) {
        this.suffuseThyroidR = suffuseThyroidR;
    }

    @Bindable
    public Integer getSuffuseThyroidL() {
        return suffuseThyroidL;
    }

    public void setSuffuseThyroidL(Integer suffuseThyroidL) {
        this.suffuseThyroidL = suffuseThyroidL;
    }

    @Bindable
    public Double getWidthThyroidR() {
        return widthThyroidR;
    }

    public void setWidthThyroidR(Double widthThyroidR) {
        this.widthThyroidR = widthThyroidR;
    }

    @Bindable
    public Double getWidthThyroidL() {
        return widthThyroidL;
    }

    public void setWidthThyroidL(Double widthThyroidL) {
        this.widthThyroidL = widthThyroidL;
    }

    @Bindable
    public Double getHeightThyroidR() {
        return heightThyroidR;
    }

    public void setHeightThyroidR(Double heightThyroidR) {
        this.heightThyroidR = heightThyroidR;
    }

    @Bindable
    public Double getHeightThyroidL() {
        return heightThyroidL;
    }

    public void setHeightThyroidL(Double heightThyroidL) {
        this.heightThyroidL = heightThyroidL;
    }

    @Bindable
    public Integer getTypeThyroidR() {
        return typeThyroidR;
    }

    public void setTypeThyroidR(Integer typeThyroidR) {
        this.typeThyroidR = typeThyroidR;
    }

    @Bindable
    public Integer getTypeThyroidL() {
        return typeThyroidL;
    }

    public void setTypeThyroidL(Integer typeThyroidL) {
        this.typeThyroidL = typeThyroidL;
    }

    @Bindable
    public Integer getEchoesThyroidR() {
        return echoesThyroidR;
    }

    public void setEchoesThyroidR(Integer echoesThyroidR) {
        this.echoesThyroidR = echoesThyroidR;
    }

    @Bindable
    public Integer getEchoesThyroidL() {
        return echoesThyroidL;
    }

    public void setEchoesThyroidL(Integer echoesThyroidL) {
        this.echoesThyroidL = echoesThyroidL;
    }

    @Bindable
    public Integer getCysticSolidThyroidR() {
        return cysticSolidThyroidR;
    }

    public void setCysticSolidThyroidR(Integer cysticSolidThyroidR) {
        this.cysticSolidThyroidR = cysticSolidThyroidR;
    }

    @Bindable
    public Integer getCysticSolidThyroidL() {
        return cysticSolidThyroidL;
    }

    public void setCysticSolidThyroidL(Integer cysticSolidThyroidL) {
        this.cysticSolidThyroidL = cysticSolidThyroidL;
    }

    @Bindable
    public Integer getBoundaryThyroidR() {
        return boundaryThyroidR;
    }

    public void setBoundaryThyroidR(Integer boundaryThyroidR) {
        this.boundaryThyroidR = boundaryThyroidR;
    }

    @Bindable
    public Integer getBoundaryThyroidL() {
        return boundaryThyroidL;
    }

    public void setBoundaryThyroidL(Integer boundaryThyroidL) {
        this.boundaryThyroidL = boundaryThyroidL;
    }

    @Bindable
    public Integer getAspectThyroidR() {
        return aspectThyroidR;
    }

    public void setAspectThyroidR(Integer aspectThyroidR) {
        this.aspectThyroidR = aspectThyroidR;
    }

    @Bindable
    public Integer getAspectThyroidL() {
        return aspectThyroidL;
    }

    public void setAspectThyroidL(Integer aspectThyroidL) {
        this.aspectThyroidL = aspectThyroidL;
    }

    @Bindable
    public Integer getCalcificationThyroidR() {
        return calcificationThyroidR;
    }

    public void setCalcificationThyroidR(Integer calcificationThyroidR) {
        this.calcificationThyroidR = calcificationThyroidR;
    }

    @Bindable
    public Integer getCalcificationThyroidL() {
        return calcificationThyroidL;
    }

    public void setCalcificationThyroidL(Integer calcificationThyroidL) {
        this.calcificationThyroidL = calcificationThyroidL;
    }

    @Bindable
    public Integer getLevelThyroidR() {
        return levelThyroidR;
    }

    public void setLevelThyroidR(Integer levelThyroidR) {
        this.levelThyroidR = levelThyroidR;
    }

    @Bindable
    public Integer getLevelThyroidL() {
        return levelThyroidL;
    }

    public void setLevelThyroidL(Integer levelThyroidL) {
        this.levelThyroidL = levelThyroidL;
    }

    @Bindable
    public Boolean getEnableThyroidR() {
        return enableThyroidR;
    }

    public void setEnableThyroidR(Boolean enableThyroidR) {
        this.enableThyroidR = enableThyroidR;
    }

    @Bindable
    public Boolean getEnableThyroidL() {
        return enableThyroidL;
    }

    public void setEnableThyroidL(Boolean enableThyroidL) {
        this.enableThyroidL = enableThyroidL;
    }

    private void updateOtherProperty(boolean isRight) {
        if (isRight) {
            if (getExceptionalThyroidR() < 2) {
                setEnableThyroidR(false);
                setSuffuseThyroidR(0);
                setWidthThyroidR(0D);
                setHeightThyroidR(0D);
                setTypeThyroidR(0);
                setEchoesThyroidR(0);
                setCysticSolidThyroidR(0);
                setBoundaryThyroidR(0);
                setAspectThyroidR(0);
                setCalcificationThyroidR(0);
                setLevelThyroidR(0);
            } else {
                setEnableThyroidR(true);
                setSuffuseThyroidR(1);
                setWidthThyroidR(1D);
                setHeightThyroidR(1D);
                setTypeThyroidR(1);
                setEchoesThyroidR(1);
                setCysticSolidThyroidR(1);
                setBoundaryThyroidR(1);
                setAspectThyroidR(1);
                setCalcificationThyroidR(1);
                setLevelThyroidR(1);
            }
        } else {
            if (getExceptionalThyroidL() < 2) {
                setEnableThyroidL(false);
                setSuffuseThyroidL(0);
                setWidthThyroidL(0D);
                setHeightThyroidL(0D);
                setTypeThyroidL(0);
                setEchoesThyroidL(0);
                setCysticSolidThyroidL(0);
                setBoundaryThyroidL(0);
                setAspectThyroidL(0);
                setCalcificationThyroidL(0);
                setLevelThyroidL(0);
            } else {
                setEnableThyroidL(true);
                setSuffuseThyroidL(1);
                setWidthThyroidL(1D);
                setHeightThyroidL(1D);
                setTypeThyroidL(1);
                setEchoesThyroidL(1);
                setCysticSolidThyroidL(1);
                setBoundaryThyroidL(1);
                setAspectThyroidL(1);
                setCalcificationThyroidL(1);
                setLevelThyroidL(1);
            }
        }
    }
}
